package com.edu.study.base.wordrelation.service.impl;

import java.util.List;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.ruoyi.common.annotation.DataSource;
import com.ruoyi.common.enums.DataSourceType;
import com.ruoyi.common.utils.DateUtils;
import com.ruoyi.common.utils.SecurityUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.edu.study.base.wordrelation.mapper.WordRelationMapper;
import com.edu.study.base.wordrelation.domain.WordRelation;
import com.edu.study.base.wordrelation.service.IWordRelationService;

/**
 * 单词归属关系Service业务层处理
 * 
 * @author zw
 * @date 2022-04-12
 */
@Service
//@DataSource(value = DataSourceType.SLAVE)
public class WordRelationServiceImpl extends ServiceImpl<WordRelationMapper, WordRelation> implements IWordRelationService
{
    @Autowired
    private WordRelationMapper wordRelationMapper;

    /**
     * 查询单词归属关系
     * 
     * @param id 单词归属关系ID
     * @return 单词归属关系
     */
    @Override
    public WordRelation selectWordRelationById(Long id)
    {
        return wordRelationMapper.selectWordRelationById(id);
    }

    /**
     * 查询单词归属关系列表
     * 
     * @param wordRelation 单词归属关系
     * @return 单词归属关系
     */
    @Override
    public List<WordRelation> selectWordRelationList(WordRelation wordRelation)
    {
        return wordRelationMapper.selectWordRelationList(wordRelation);
    }

    /**
     * 新增单词归属关系
     * 
     * @param wordRelation 单词归属关系
     * @return 结果
     */
    @Override
    public int insertWordRelation(WordRelation wordRelation)
    {
        wordRelation.setCreateTime(DateUtils.getNowDate());
        wordRelation.setCreateBy(SecurityUtils.getUsername());
        return wordRelationMapper.insertWordRelation(wordRelation);
    }

    @Override
    public int insertWordRelationList(List<WordRelation> wordRelationList) {
        return wordRelationMapper.insertWordRelationList(wordRelationList);
    }

    /**
     * 修改单词归属关系
     * 
     * @param wordRelation 单词归属关系
     * @return 结果
     */
    @Override
    public int updateWordRelation(WordRelation wordRelation)
    {
        return wordRelationMapper.updateWordRelation(wordRelation);
    }

    /**
     * 批量删除单词归属关系
     * 
     * @param ids 需要删除的单词归属关系ID
     * @return 结果
     */
    @Override
    public int deleteWordRelationByIds(Long[] ids)
    {
        return wordRelationMapper.deleteWordRelationByIds(ids);
    }

    /**
     * 删除单词归属关系信息
     * 
     * @param id 单词归属关系ID
     * @return 结果
     */
    @Override
    public int deleteWordRelationById(Long id)
    {
        return wordRelationMapper.deleteWordRelationById(id);
    }
}
